Return the URI of the GtkRecentInfo object (upgraded to UTF-8 if needed)
authorEmmanuele Bassi <ebassi@gnome.org>
Thu, 16 Nov 2006 11:12:12 +0000 (11:12 +0000)
committerEmmanuele Bassi <ebassi@src.gnome.org>
Thu, 16 Nov 2006 11:12:12 +0000 (11:12 +0000)
2006-11-16  Emmanuele Bassi  <ebassi@gnome.org>

* gtk/gtkrecentmanager.c:
(gtk_recent_info_get_uri_display): Return the URI
of the GtkRecentInfo object (upgraded to UTF-8 if
needed) in case of non-local file. (#351945)

ChangeLog
gtk/gtkrecentmanager.c

index 171e5937862b4a6711ac0c1035a15006a80d10c5..0a95d7fdf7711e7e7d9cd2a5895dfa1d691e94b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-16  Emmanuele Bassi  <ebassi@gnome.org>
+
+       * gtk/gtkrecentmanager.c:
+       (gtk_recent_info_get_uri_display): Return the URI
+       of the GtkRecentInfo object (upgraded to UTF-8 if
+       needed) in case of non-local file. (#351945)
+
 2006-11-16  Emmanuele Bassi  <ebassi@gnome.org>
        
        * gtk/gtkrecentchoosermenu.c:
index 24baf5d772da684472963276ccf83378e0d831ae..68ac0de538a7dd9cf871e6ae9fe575f7eea6f00b 100644 (file)
@@ -2295,7 +2295,9 @@ gtk_recent_info_get_short_name (GtkRecentInfo *info)
  * gtk_recent_info_get_uri_display:
  * @info: a #GtkRecentInfo
  *
- * Gets a displayable version of the resource's URI.
+ * Gets a displayable version of the resource's URI.  If the resource
+ * is local, it returns a local path; if the resource is not local,
+ * it returns the UTF-8 encoded content of gtk_recent_info_get_uri().
  *
  * Return value: a UTF-8 string containing the resource's URI or %NULL
  *
@@ -2304,18 +2306,28 @@ gtk_recent_info_get_short_name (GtkRecentInfo *info)
 gchar *
 gtk_recent_info_get_uri_display (GtkRecentInfo *info)
 {
-  gchar *filename, *filename_utf8;
+  gchar *retval;
   
   g_return_val_if_fail (info != NULL, NULL);
-  
-  filename = g_filename_from_uri (info->uri, NULL, NULL);
-  if (!filename)
-    return NULL;
+
+  retval = NULL;
+  if (gtk_recent_info_is_local (info))
+    {
+      gchar *filename;
+
+      filename = g_filename_from_uri (info->uri, NULL, NULL);
+      if (!filename)
+        return NULL;
       
-  filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
-  g_free (filename);
+      retval = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+      g_free (filename);
+    }
+  else
+    {
+      retval = make_valid_utf8 (info->uri);
+    }
 
-  return filename_utf8;
+  return retval;
 }
 
 /**